#ifndef __model_h__
#define __model_h__

#include <string>
#include <vector>

class Predictor_base;
class Model_link;
class Trace;

using namespace std;

class Model
{
public:
  Model(Predictor_base *p);
  Model(Model *m);
  ~Model();

  // Interface toward machines
  void calculate_error(float t);

  void activate(float critical_error);
  void activate_output_link(void);

  void save_state(float t);

  bool is_active(void);

  string info(void);

  void reset(void);

  void predict(float t);

  // access to output
  float get_output_value() const;

  // Construction/modification interface
  void set_string_id(string id);
  string get_string_id(void);

  Model_link *get_output_link(void);
  void set_output_link(Model_link *l);

  Predictor_base *get_predictor(void);

  // inhibitor links
  void add_inhibitor_link(Model *m);
  void add_inhibitor_link(Model_link *l);
  void remove_inhibitor_link(Model *m);
  void remove_inhibitor_link(Model_link *l);

  // activator links
  void add_activator_link(Model *m);
  void add_activator_link(Model_link *l);
  void remove_activator_link(Model *m);
  void remove_activator_link(Model_link *l);

private:
  vector<Model *> _models;

  vector<Model_link *> _inhibitor_links;
  vector<Model_link *> _activator_links;

  bool _active;

  string _string_id;

  // unique id
  int _id;

  Model_link *_output_link;

  Predictor_base *_predictor;
};

#endif
